#include "TileManager.h"
#include "TileMap.h"
#include "BaseObject.h"


CTileManager* CTileManager::s_Instance = nullptr;


CTileManager* CTileManager::GetInstance( void )
{
	if( s_Instance == nullptr )
		s_Instance = new CTileManager;

	return s_Instance;
}


void CTileManager::DeleteInstance( void )
{
	if( s_Instance != nullptr )
		delete s_Instance;
}


CTileManager::CTileManager(void)
{
	m_pTileMap = nullptr;
}


CTileManager::~CTileManager(void)
{
}


void CTileManager::RenderMap( void )
{
	//if( m_pTileMap != nullptr )
	m_pTileMap->RenderMap();
		
}


void CTileManager::UpdateMap( float dPosition )
{

}


bool CTileManager::CheckWorldCollision( CBaseObject* pOther )
{
	return m_pTileMap->CheckCharacterCollision( pOther );
}


bool CTileManager::LoadMap( const char * szFilename )
{
	TiXmlDocument doc;

	if( !doc.LoadFile( szFilename ) )
		return false;

	TiXmlElement* pRoot = doc.RootElement();
	if( !pRoot )
		return false;

	
	//CLetter letter;
	//TiXmlElement* pLetter = pRoot->FirstChildElement( "Letter" );
	return false;
}
